package com.gla.dao;

import com.gla.dto.OrderDetailDTO;
import com.gla.dto.OrderInfoDTO;
import com.gla.entity.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper {

    @Select("SELECT * FROM ORDERS WHERE id=#{id}")
    List<Order> selectById(Integer id);

    List<Order> select(Order order);

    OrderInfoDTO getDetail(Integer id);

    List<OrderDetailDTO> getOrderDetails(Integer order_id);

    void update(Order order);

    @Delete("DELETE FROM ORDERS WHERE id=#{id}")
    void deleteOrder(Integer id);

    @Delete("DELETE FROM ORDERDETAIL WHERE order_id = #{id}")
    void deleteOrderDetailByOrderId(Integer id);
}
